<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <title>测试 - layui</title>
  <link rel="stylesheet" href="./js/layui/css/layui.css">
</head>

<body>

  <div class="layui-container">
    <div id="layer-photos-demo" class="layer-photos-demo">
      <img layer-pid="pic" layer-src="./img/01.jpg" width="100" height="100" src="./img/01.jpg" alt="图片名">
    </div>
  </div>
  </div>



  <!-- 引入 layui.js 的 <script> 标签最好放置在 html 末尾 -->
  <script src="./js/layui/layui.js"></script>
  <script src="./js/jquery-1.9.1.min.js"></script>
  <script>
    layui.use(function () {

      layer.photos({
        photos: '#layer-photos-demo',
        anim: 3, //0-6的选择，指定弹出图片动画类型，默认随机（请注意，3.0之前的版本用shift参数）
        closeBtn: 1,
        tab: function () {
          num = 0;
          $("#layui-layer-photos").append(
            '<div class="icon" style="position:relative;width:100%;text-align:center;top:-133px;cursor:pointer;">\n' +
            '\t\t<img src="xz.png" style="width:30px;height:30px;">\n' +
            '\t</div>');
        }
      });


      $(document).on("click", ".icon img", function (e) {
        num = (num + 90) % 360;
        $(".layui-layer.layui-layer-page.layui-layer-photos").css('transform', 'rotate(' + num + 'deg)');

        //$(".layui-layer-phimg img").css('transform','rotate('+num+'deg)');此处只能旋转图片
      });
    });
  </script>
</body>

</html>